home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / PCCardTuples.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  14KB  |  419 lines

  1. /*
  2.      File:        PCCardTuples.h
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __PCCARDTUPLES__
  19. #define __PCCARDTUPLES__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. #if PRAGMA_IMPORT_SUPPORTED
  30. #pragma import on
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37.  
  38. enum {
  39.     MAX_TUPLE_SIZE                = 256
  40. };
  41.  
  42. /*
  43. ------------------------------------------------------------------------------------------------------------------------------------------------
  44.     Defines for Tuple codes
  45. ------------------------------------------------------------------------------------------------------------------------------------------------
  46. */
  47.  
  48. enum {
  49.     CISTPL_NULL                    = 0x00,
  50.     CISTPL_DEVICE                = 0x01,
  51.     CISTPL_LONGLINK_MFC            = 0x06,
  52.     CISTPL_CHECKSUM                = 0x10,
  53.     CISTPL_LONGLINK_A            = 0x11,
  54.     CISTPL_LONGLINK_C            = 0x12,
  55.     CISTPL_LINKTARGET            = 0x13,
  56.     CISTPL_NO_LINK                = 0x14,
  57.     CISTPL_VERS_1                = 0x15,
  58.     CISTPL_ALTSTR                = 0x16,
  59.     CISTPL_DEVICE_A                = 0x17,
  60.     CISTPL_JEDEC_C                = 0x18,
  61.     CISTPL_JEDEC_A                = 0x19,
  62.     CISTPL_CONFIG                = 0x1A,
  63.     CISTPL_CFTABLE_ENTRY        = 0x1B,
  64.     CISTPL_DEVICE_OC            = 0x1C,
  65.     CISTPL_DEVICE_OA            = 0x1D,
  66.     CISTPL_DEVICE_GEO            = 0x1E,
  67.     CISTPL_DEVICE_GEO_A            = 0x1F,
  68.     CISTPL_MANFID                = 0x20,
  69.     CISTPL_FUNCID                = 0x21,
  70.     CISTPL_FUNCE                = 0x22,
  71.     CISTPL_SWIL                    = 0x23,
  72.     CISTPL_VERS_2                = 0x40,
  73.     CISTPL_FORMAT                = 0x41,
  74.     CISTPL_GEOMETRY                = 0x42,
  75.     CISTPL_BYTEORDER            = 0x43,
  76.     CISTPL_DATE                    = 0x44,
  77.     CISTPL_BATTERY                = 0x45,
  78.     CISTPL_ORG                    = 0x46,
  79.     CISTPL_VENDOR                = 0xFE,
  80.     CISTPL_END                    = 0xFF
  81. };
  82.  
  83. /*
  84. ------------------------------------------------------------------------------------------------------------------------------------------------
  85.     Tuple Data Block Definitions
  86. ------------------------------------------------------------------------------------------------------------------------------------------------
  87. */
  88. /*------------    Device Information Tuple (01H, 17H)    -----------                            */
  89. struct DeviceIDTuple {
  90.     Byte                             TPLDEV_TYPE_WPS_SPEED;        /* Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0*/
  91.     Byte                             deviceData[253];
  92. };
  93. typedef struct DeviceIDTuple DeviceIDTuple;
  94.  
  95.  
  96. enum {
  97.     TPLDEV_TYPE_MASK            = 0xF0,                            /* device type mask for TPLDEV_TYPE_WPS_SPEED*/
  98.     TPLDEV_TYPE_EXTENDED        = 0xE0,                            /* device type value for extended type*/
  99.     TPLDEV_WPS_MASK                = 0x08,                            /* write-protect switch mask for TPLDEV_TYPE_WPS_SPEED*/
  100.     TPLDEV_SPEED_MASK            = 0x07,                            /* device speed mask for TPLDEV_TYPE_WPS_SPEED*/
  101.     TPLDEV_DSPEED_NULL            = 0x00,                            /* speed for null device type*/
  102.     TPLDEV_DSPEED_250NS            = 0x01,                            /* 250ns card access time*/
  103.     TPLDEV_DSPEED_200NS            = 0x02,                            /* 200ns card access time*/
  104.     TPLDEV_DSPEED_150NS            = 0x03,                            /* 150ns card access time*/
  105.     TPLDEV_DSPEED_100NS            = 0x04,                            /* 100ns card access time*/
  106.     TPLDEV_EXTENDED_SPEED        = 0x07,                            /* device speed value for extended speed*/
  107.     TPLDEV_SPEED_EXPONENT        = 0x07,                            /* extended byte exponent mask*/
  108.     TPLDEV_SPEED_MANTISSA        = 0x78,                            /* extended byte mantissa mask*/
  109.     TPLDEV_SPEED_EXTENDED_MASK    = 0x80                            /* bit set if more extended speed data follows*/
  110. };
  111.  
  112. /*    device ID types*/
  113.  
  114. enum {
  115.     DTYPE_NULL                    = 0,
  116.     DTYPE_ROM                    = 1,
  117.     DTYPE_OTPROM                = 2,
  118.     DTYPE_EPROM                    = 3,
  119.     DTYPE_EEPROM                = 4,
  120.     DTYPE_FLASH                    = 5,
  121.     DTYPE_SRAM                    = 6,
  122.     DTYPE_DRAM                    = 7,
  123.     DTYPE_FUNCSPEC                = 0x0D,
  124.     DTYPE_EXTEND                = 0x0E
  125. };
  126.  
  127. /*---------------    Checksum Control Tuple (10H)    ---------------                            */
  128. struct ChecksumControlTuple {
  129.     short                             TPLCKS_ADDR;                /* offset to region to be checksummed, LSB first*/
  130.     short                             TPLCKS_LEN;                    /* length of region to be checksummed, LSB first*/
  131.     char                             TPLCKS_CS;                    /* checksum of the region*/
  132.     Byte                             reserved;                    /* padding*/
  133. };
  134. typedef struct ChecksumControlTuple ChecksumControlTuple;
  135.  
  136. /*----------------    Long Link Multi-Function Tuple (06H)    ------                    */
  137. struct LongLinkMFCTuple {
  138.     UInt8                             TPLMFC_NUM;                    /* Number of sets of config registers for individual functions*/
  139.  
  140.     UInt8                             TPLMFC_TAS1;                /* CIS target address space for first function (00 = Attr, 01 = Common)*/
  141.     UInt32                             TPLMFC_ADDR1;                /* Target address of first CIS, unsigned long, lsb first*/
  142.  
  143.     UInt8                             TPLMFC_TAS2;                /* CIS target address space for second function (00 = Attr, 01 = Common)*/
  144.     UInt8                             TPLMFC_ADDR2[4];            /* [MISALIGNED!] Target address of second CIS, unsigned long, lsb first*/
  145.  
  146.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  147.                                                                 /* */
  148.                                                                 /* UInt8        TPLMFC_TASn;*/
  149.                                                                 /* UInt32        TPLMFC_ADDRn;*/
  150. };
  151. typedef struct LongLinkMFCTuple LongLinkMFCTuple;
  152.  
  153. /*----------------    Long Link Tuple (11H, 12H)    ----------------                            */
  154. struct LongLinkTuple {
  155.     UInt32                             TPLL_ADDR;                    /* target address, LSB first*/
  156. };
  157. typedef struct LongLinkTuple LongLinkTuple;
  158.  
  159. /*-----------------    Link Target Tuple (13H)    ------------------                            */
  160. struct LinkTargetTuple {
  161.     Byte                             TPLL_TAG[3];                /* tag: should be 'C', 'I', 'S'*/
  162. };
  163. typedef struct LinkTargetTuple LinkTargetTuple;
  164.  
  165. /*----------------    Level 1 Version Tuple (15H)    ---------------                            */
  166. struct Level1VersionTuple {
  167.     Byte                             TPLLV1_MAJOR;                /* major version number (0x04)*/
  168.     Byte                             TPLLV1_MINOR;                /* minor version number (0x01 for release 2.0 and 2.01)*/
  169.     Byte                             TPLLV1_INFO[1];                /* product information string, zero-terminated*/
  170. };
  171. typedef struct Level1VersionTuple Level1VersionTuple;
  172.  
  173. /*-------------    JEDEC Identifier Tuple (18H, 19H)    ------------                            */
  174. struct JEDECDeviceInfo {
  175.     Byte                             manufacturerID;
  176.     Byte                             manufacturerInfo;
  177. };
  178. typedef struct JEDECDeviceInfo JEDECDeviceInfo;
  179.  
  180. struct JEDECIdentifierTuple {
  181.     JEDECDeviceInfo                 device[1];
  182. };
  183. typedef struct JEDECIdentifierTuple JEDECIdentifierTuple;
  184.  
  185. /*---------    Configuration Tuple (1AH)    ----------                            */
  186. struct ConfigTuple {
  187.     Byte                             TPCC_SZ;                    /* size of fields byte*/
  188.     Byte                             TPCC_LAST;                    /* index number of last config entry*/
  189.     Byte                             TPCC_RADR;                    /* config reg's base addr in reg. space*/
  190.     Byte                             reserved;                    /* padding*/
  191.  
  192.                                                                 /* the following fields are of undetermined length and should be calculated at runtime*/
  193.                                                                 /*UInt32            TPCC_RMSK;*/
  194.                                                                 /*UInt32            TPCC_RSVD;*/
  195.                                                                 /*UInt32            TPCC_SBTPL;*/
  196. };
  197. typedef struct ConfigTuple ConfigTuple;
  198.  
  199. /*    TPCC_RADR field definitions*/
  200.  
  201. enum {
  202.     TPCC_RASZ                    = 0x03,                            /* bits 1-0*/
  203.     TPCC_RMSZ                    = 0x3C,                            /* bits 5-2*/
  204.     TPCC_RFSZ                    = 0xC0                            /* bits 7-6*/
  205. };
  206.  
  207. /*---------    Device Geometry Tuple (1EH, 1FH)    ----------*/
  208. struct DeviceGeometry {
  209.     UInt8                             DGTPL_BUS;                    /* system bus width = 2^(n-1), n>0*/
  210.     UInt8                             DGTPL_EBS;                    /* erase block size = 2^(n-1), n>0*/
  211.     UInt8                             DGTPL_RBS;                    /* read block size = 2^(n-1), n>0*/
  212.     UInt8                             DGTPL_WBS;                    /* write block size = 2^(n-1), n>0*/
  213.     UInt8                             DGTPL_PART;                    /* partitioning size = 2^(n-1), n>0*/
  214.     UInt8                             DGTPL_HWIL;                    /* hardware interleave = 2^(n-1), n>0*/
  215. };
  216. typedef struct DeviceGeometry DeviceGeometry;
  217.  
  218. struct DeviceGeometryTuple {
  219.     DeviceGeometry                     device[42];
  220. };
  221. typedef struct DeviceGeometryTuple DeviceGeometryTuple;
  222.  
  223. /*---------    Manufacturer Identification Tuple (20H)    ----------                            */
  224. struct ManufIDTuple {
  225.     short                             TPLMID_MANF;                /* PCMCIA PC Card manufacturer code*/
  226.     short                             TPLMID_CARD;                /* manufacturer information (part number and/or revision)*/
  227. };
  228. typedef struct ManufIDTuple ManufIDTuple;
  229.  
  230. /*-----------    Function Identification Tuple (21H)    ------------                            */
  231. struct FunctionIDTuple {
  232.     Byte                             TPLFID_FUNCTION;            /* PC card function code*/
  233.     Byte                             TPLFID_SYSINIT;                /* system initialization bit mask*/
  234. };
  235. typedef struct FunctionIDTuple FunctionIDTuple;
  236.  
  237. /*    function codes*/
  238.  
  239. enum {
  240.     TPLFID_MultiFunction        = 0,
  241.     TPLFID_Memory                = 1,
  242.     TPLFID_SerialPort            = 2,
  243.     TPLFID_ParallelPort            = 3,
  244.     TPLFID_FixedDisk            = 4,
  245.     TPLFID_VideoAdaptor            = 5,
  246.     TPLFID_NetworkLANAdaptor    = 6,
  247.     TPLFID_AIMS                    = 7
  248. };
  249.  
  250. /*------------    Software Interleave Tuple (23H)    ---------------                            */
  251. struct SoftwareInterleaveTuple {
  252.     char                             TPLSWIL_INTRLV;                /* software interleave*/
  253. };
  254. typedef struct SoftwareInterleaveTuple SoftwareInterleaveTuple;
  255.  
  256. /*-------    Level 2 Version and Information Tuple (40H)    --------                            */
  257. struct Level2VersionTuple {
  258.     Byte                             TPLLV2_VERS;                /* structure version (0x00)*/
  259.     Byte                             TPLLV2_COMPLY;                /* level of compliance with the standard (0x00)*/
  260.     UInt16                             TPLLV2_DINDEX;                /* byte address of first data byte in card, LSB first*/
  261.     Byte                             TPLLV2_RSV6;                /* reserved, must be zero*/
  262.     Byte                             TPLLV2_RSV7;                /* reserved, must be zero*/
  263.     Byte                             TPLLV2_VSPEC8;                /* vendor specific byte*/
  264.     Byte                             TPLLV2_VSPEC9;                /* vendor specific byte*/
  265.     char                             TPLLV2_NHDR;                /* number of copies of CIS present on this device*/
  266.     char                             TPLLV2_OEM[1];                /* vendor of software that formatted card, zero-terminated*/
  267.     char                             TPLLV2_INFO[1];                /* informational message about the card, zero-terminated*/
  268.     Byte                             reserved;                    /* padding*/
  269. };
  270. typedef struct Level2VersionTuple Level2VersionTuple;
  271.  
  272. /*
  273. --------------------    Format Tuple (41H)    --------------------                            
  274.  additional information for disk type:
  275. */
  276. struct FormatDiskTuple {
  277.     UInt16                             TPLFMT_BKSZ;                /*    block size, or zero if unblocked format*/
  278.     UInt32                             TPLFMT_NBLOCKS;                /*    number of data blocks in this partition*/
  279.     UInt32                             TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  280. };
  281. typedef struct FormatDiskTuple FormatDiskTuple;
  282.  
  283. /* additional information for disk type:*/
  284. struct FormatMemTuple {
  285.     Byte                             TPLFMT_FLAGS;                /*    various flags*/
  286.     Byte                             TPLFMT_RESERVED;            /*    reserved, set to zero*/
  287.     UInt32                             TPLFMT_ADDRESS;                /*    physical location at which this memory partion must be mapped*/
  288.     UInt32                             TPLFMT_EDCLOC;                /*    location of error detection code, or zero if interleaved*/
  289. };
  290. typedef struct FormatMemTuple FormatMemTuple;
  291.  
  292. struct FormatTuple {
  293.     char                             TPLFMT_TYPE;                /* format type code*/
  294.     char                             TPLFMT_EDC;                    /* error detection method and length of error detection code*/
  295.     long                             TPLFMT_OFFSET;                /* offset to first data byte in this partition*/
  296.     long                             TPLFMT_NBYTES;                /* number of data bytes in this partition*/
  297.     union {
  298.         FormatDiskTuple                 TPLFMT_DISK;
  299.         FormatMemTuple                     TPLFMT_MEM;
  300.     }                                 u;
  301. };
  302. typedef struct FormatTuple FormatTuple;
  303.  
  304. /*    format types*/
  305.  
  306. enum {
  307.     TPLFMTTYPE_DISK                = 0,
  308.     TPLFMTTYPE_MEM                = 1,
  309.     TPLFMTTYPE_VS                = 0x80
  310. };
  311.  
  312. /*    error detection types*/
  313.  
  314. enum {
  315.     TPLFMTEDC_NONE                = 0,
  316.     TPLFMTEDC_CKSUM                = 1,
  317.     TPLFMTEDC_CRC                = 2,
  318.     TPLFMTEDC_PCC                = 3,
  319.     TPLFMTEDC_VS                = 8
  320. };
  321.  
  322. /*    bits in TPLFMT_FLAGS*/
  323.  
  324. enum {
  325.     TPLFMTFLAGS_ADDR            = 0,
  326.     TPLFMTFLAGS_AUTO            = 1
  327. };
  328.  
  329. /*------------------    Geometry Tuple (42H)    --------------------                            */
  330. struct GeometryTuple {
  331.     char                             TPLGEO_SPT;                    /* number of sectors per track*/
  332.     char                             TPLGEO_TPC;                    /* number of tracks per cylinder*/
  333.     short                             TPLGEO_NCYL;                /* number of cylinders, total*/
  334. };
  335. typedef struct GeometryTuple GeometryTuple;
  336.  
  337. /*-----------------    Byte-Order Tuple (43H)    -------------------                            */
  338. struct ByteOrderTuple {
  339.     char                             TPLBYTE_ORDER;                /* byte order code*/
  340.     char                             TPLBYTE_MAP;                /* byte mapping code*/
  341. };
  342. typedef struct ByteOrderTuple ByteOrderTuple;
  343.  
  344. /*    byte order codes*/
  345.  
  346. enum {
  347.     TYPBYTEORD_LOW                = 0,
  348.     TYPBYTEORD_HIGH                = 1,
  349.     TYPBYTEORD_VS                = 0x80
  350. };
  351.  
  352. /*    byte mapping codes*/
  353.  
  354. enum {
  355.     TYPBYTEMAP_LOW                = 0,
  356.     TYPBYTEMAP_HIGH                = 1,
  357.     TYPBYTEMAP_VS                = 0x80
  358. };
  359.  
  360. /*----------    Card Initialization Date Tuple (44H)    ------------                            */
  361. struct CardInitDateTuple {
  362.     UInt16                             TPLDATE_TIME;                /* hours, minutes, seconds*/
  363.     UInt16                             TPLDATE_DAY;                /* year, month, day*/
  364. };
  365. typedef struct CardInitDateTuple CardInitDateTuple;
  366.  
  367. /*----------    Battery-Replacement Date Tuple (45H)    ------------                            */
  368. struct BatteryReplaceDateTuple {
  369.     UInt16                             TPLBATT_RDAY;                /* last replacement date (year, month, day)*/
  370.     UInt16                             TPLBATT_XDAY;                /* battery expiration date (year, month, day)*/
  371. };
  372. typedef struct BatteryReplaceDateTuple BatteryReplaceDateTuple;
  373.  
  374. /*----------------------    General Tuple    -----------------------                            */
  375. union TupleBody {
  376.     DeviceIDTuple                     deviceID;
  377.     ChecksumControlTuple             checksum;
  378.     LongLinkTuple                     link;
  379.     LinkTargetTuple                 target;
  380.     Level1VersionTuple                 level1;
  381.     JEDECIdentifierTuple             jedecID;
  382.     ConfigTuple                     config;
  383.     DeviceGeometryTuple             devGeo;
  384.     ManufIDTuple                     manufID;
  385.     FunctionIDTuple                 funcID;
  386.     SoftwareInterleaveTuple         swil;
  387.     Level2VersionTuple                 level2;
  388.     FormatTuple                     format;
  389.     GeometryTuple                     geometry;
  390.     ByteOrderTuple                     order;
  391.     CardInitDateTuple                 initDate;
  392.     BatteryReplaceDateTuple         battDate;
  393.     Byte                             tupleData[254];
  394. };
  395. typedef union TupleBody TupleBody;
  396.  
  397. struct Tuple {
  398.     Byte                             TPL_CODE;
  399.     Byte                             TPL_LINK;
  400.     TupleBody                         TPL_BODY;
  401. };
  402. typedef struct Tuple Tuple;
  403.  
  404.  
  405. #if PRAGMA_ALIGN_SUPPORTED
  406. #pragma options align=reset
  407. #endif
  408.  
  409. #if PRAGMA_IMPORT_SUPPORTED
  410. #pragma import off
  411. #endif
  412.  
  413. #ifdef __cplusplus
  414. }
  415. #endif
  416.  
  417. #endif /* __PCCARDTUPLES__ */
  418.  
  419.